<?php
//var_dump();
class BaseModel  extends \Phalcon\Mvc\Model
{
    public $fileUrl='http://jiruanadmin.com';
	public $redis;
    public function initialize()
		    {
				$this->redis=$this->getDI()->getredis();
				    }
	public  function  get_cache($redis_key){
		return  json_decode($this->redis->get($redis_key),TRUE);
	}
	public function set_cache($redis_key,$redis_value,$expire=60*60*2){
		$this->redis->set($redis_key,json_encode($redis_value));
		$this->redis->expire($redis_key,$expire);
		return  json_decode($this->redis->get($redis_key),TRUE);
	}

	public function del_cache($redis_key){
	    return $this->redis->del($redis_key);
    }
}
